import logging

from redis import StrictRedis


class Config(object):
    '''项目的配置'''
    DEBUG = False
    SECRET_KEY = 'sfefvcxgergfvhgf'
    # mysql 配置
    SQLALCHEMY_DATABASE_URI = 'mysql+pymysql://root:root@127.0.0.1:3306/information001'
    SQLALCHEMY_TRACK_MODIFICATIONS = False
    SQLALCHEMY_COMMIT_ON_TEARDOWN = True

#     redis 配置
    REDIS_HOST = '127.0.0.1'
    REDIS_PORT = 6379
#     session保存配置

    SESSION_TYPE = 'redis'
    SESSION_USE_SIGNER = True
    permanent_session_lifetime = 86400 *2
    SESSION_PERMANENT = False
    SESSION_REDIS = StrictRedis(host=REDIS_HOST,port=REDIS_PORT)
    LOG_LOVEL = logging.DEBUG



class Development(Config):
    DEBUG = True

class ProductionConfig(Config):
    DEBUG = False
    LOG_LOVEL = logging.WARNING

class TestingConfig(Config):
    DEBUG = True
    Testing = True

config = {
    "development":Development,
    "production":ProductionConfig,
    "testing":TestingConfig
}